#include <iostream>
using namespace std;
//2018
// 41.
int partition(int arr[],int low,int high) {
    int mid = arr[low];
    while (low < high) {
        while (low < high && mid <= arr[high])
            high--;
        arr[low] = arr[high];
        while (low < high && mid >= arr[low])
            low++;
        arr[high] = arr[low];

    }
    arr[low] = mid;
    return low;
}

void quickSort(int arr[],int low,int high) {
    if (low < high) {
        int mid = partition(arr,low,high);
        quickSort(arr,low,mid-1);
        quickSort(arr,mid+1,high);
    }
}





int main() {
    std::cout << "Hello, World!" << std::endl;
    int array[4] = {-5,3,2,3};
    int array2[3] = {1,2,3};
    quickSort(array,0,4);

    int temp1 = 1;
    for (int i = 0; i < 4; ++i) {
        if (array[i]>=0 && temp1 != i+1) {
            break;
        }
        if(array[i] >= 0 && temp1 == i+1) {
            temp1++;
        }
    }
    int temp2 = 1;
    for (int i = 0; i < 3; ++i) {
        if (array2[i]>=0 && temp2 != i+1) {
            break;
        }
        if(array2[i] >= 0 && temp2 == i+1) {
            temp2++;
        }
    }
    cout<<"1: "<<temp1<<endl;
    cout<<"2: "<<temp2;

    return 0;
}
